package com.itheima.d0_homework.timu4;

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        String userName = "[a-zA-Z0-9_]{3,16}";
        String passWord = "[a-zA-Z0-9]+\\.*[a-zA-Z0-9]+";
        String email = "[a-zA-Z0-9_]+@([a-z]+\\.[a-z]+)+";

        Scanner scanner = new Scanner(System.in);

        while (true){
            System.out.println("请输入用户名");
            String userName1 = scanner.next();
            System.out.println("请输入密码");
               String passWord1 = scanner.next();
            System.out.println("请输入邮箱");
            String email1 = scanner.next();

            boolean matches = userName1.matches(userName);
            boolean matches1 = passWord1.matches(passWord);
            boolean matches2 = email1.matches(email);

            if(matches&&matches1&&matches2){
                System.out.println("输出正确");
                break;
            }else {
                System.out.println("输入错误");
            }
        }

    }
}
